package org.sluggard.tangela.core;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

public class FileMenu extends JMenu {

	public FileMenu() {
		super();
		initComponents();
	}
	
	private void initComponents() {
		setText("File");
        exit = new javax.swing.JMenuItem();
        exit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK));
        exit.setText("Exit");
        exit.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				SecurityManager security = System.getSecurityManager();
                if (security != null) {
                    security.checkExit(0);
                }
                System.exit(0);
			}
		});
        add(exit);
	}
	
	private JMenuItem exit;
	
}
